<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      lang="zh-CN"
      xmlns:th="http://www.thymeleaf.org"
      xmlns="http://www.w3.org/1999/xhtml" layout:decorate="~{layout/template}">
<head>
    <title>内容管理</title>
    <link rel="stylesheet" href="/css/cms/content/list.css"/>
</head>
<body>
<div id="contentContainer" layout:fragment="content" class="contentContainer" v-cloak>

    <el-row id="toolbar">
        <el-col :span="12">
            <div class="pull-left">
                <el-select v-model="contentStatus" clearable
                           placeholder="所有状态"
                           @change="onSearch"
                           @clear="onSearch">
                    <el-option
                            v-for="item in statusOptions"
                            :key="item.value"
                            :label="item.key"
                            :value="item.value">
                    </el-option>
                </el-select>
                <el-input v-model="keyword" @keyup.enter.native="onSearch" class="searchBox"
                          placeholder="请输入关键词"></el-input>
                <el-button type="primary" @click.native="onSearch">
                    <i class="fa fa-search"></i>
                    <span>查询</span>
                </el-button>
            </div>
        </el-col>
        <el-col :span="12">
            <div class="pull-right">
                <el-button-group>
                    <el-button th:if="${addFunc!=null}" @click.native="onAdd">
                        <i th:class="${addFunc.iconClass}"></i>
                        <span th:text="${addFunc.name}"></span>
                    </el-button>
                    <el-button th:if="${editFunc!=null}" @click.native="onEdit">
                        <i th:class="${editFunc.iconClass}"></i>
                        <span th:text="${editFunc.name}"></span>
                    </el-button>
                    <el-button th:if="${publishFunc!=null}" @click.native="onPublish">
                        <i th:class="${publishFunc.iconClass}"></i>
                        <span th:text="${publishFunc.name}"></span>
                    </el-button>
                </el-button-group>

                <el-button-group>
                    <el-button th:if="${deleteFunc!=null}" @click.native="onDelete">
                        <i th:class="${deleteFunc.iconClass}"></i>
                        <span th:text="${deleteFunc.name}"></span>
                    </el-button>
                    <el-button th:if="${restoreFunc!=null}" @click.native="onRestore">
                        <i th:class="${restoreFunc.iconClass}"></i>
                        <span th:text="${restoreFunc.name}"></span>
                    </el-button>
                </el-button-group>
            </div>
        </el-col>
    </el-row>

    <el-row>
        <el-col :span="5">
            <div class="tree-layout">
                <div class="tree">
                    <el-tree
                            ref="tree"
                            node-key="id"
                            :default-expanded-keys="[0]"
                            @node-click="onTreeNodeClick"
                            :indent="16"
                            :data="treeData"
                            :props="treeProps">
                    </el-tree>
                </div>
            </div>
        </el-col>
        <el-col :span="19">
            <el-row>
                <el-table
                        ref="multipleTable"
                        tooltip-effect="light"
                        class="dataTable"
                        :data="tableData"
                        :height="tableHeight"
                        @selection-change="onSelectionChange">
                    <el-table-column
                            type="selection"
                            width="50">
                    </el-table-column>
                    <el-table-column
                            prop="title"
                            label="标题">
                        <template scope="scope">
                            <el-button type="text" @click="preview(scope.row.contentId)">
                                <span v-if="scope.row.topLevel>0" class="cms-ups">[置顶]</span>
                                {{scope.row.title}}
                            </el-button>
                        </template>
                    </el-table-column>
                    <el-table-column
                            prop="channelName"
                            label="栏目"
                            align="center"
                            width="100">
                    </el-table-column>
                    <el-table-column
                            prop="userName"
                            label="发布者"
                            align="center"
                            width="80">
                    </el-table-column>
                    <el-table-column
                            prop="viewCount"
                            label="浏览次数"
                            align="center"
                            width="80">
                    </el-table-column>
                    <el-table-column
                            prop="releaseDate"
                            label="发布时间"
                            align="center"
                            width="150">
                    </el-table-column>
                    <el-table-column
                            prop="contentStatus"
                            label="状态"
                            align="center"
                            width="80">
                        <template scope="scope">
                            <el-button type="text"
                                       v-for="status in statusOptions"
                                       v-if="scope.row.contentStatus==status.value"
                                       @click="showAuditSteps(scope.row.contentId)">
                                {{ status.key }}
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-row>

            <el-row id="pagination">
                <div class="pull-right">
                    <el-pagination
                            layout="total, sizes, prev, pager, next, jumper"
                            :current-page="pageNum"
                            :page-size="pageSize"
                            :page-sizes="pageSizes"
                            :total="total"
                            @size-change="onSizeChange"
                            @current-change="onCurrentChange">
                    </el-pagination>
                </div>
            </el-row>
        </el-col>
    </el-row>

</div>

<th:block layout:fragment="staticFile">
    <script src="/plugins/jQuery-slimScroll-1.3.8/jquery.slimscroll.min.js"></script>
    <script src="/js/cms/content/list.js"></script>
</th:block>

</body>
</html>